<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<script>

test(function () {
  var i = document.createElement("iframe");

  document.body.appendChild(i);

  var d = i.contentDocument.open();

  d.write("<style>@font-face { font-family: f1; src: url(); } @font-face { font-family: f2; src: url(); }</style>");
  d.close();

  var frame_FontFace = i.contentWindow.FontFace;

  var c = 0;
  d.fonts.forEach(function (f) {
    assert_equals(f.constructor, frame_FontFace, "constructed in frame context");

    if (++c == 1) {
      // First iteration: navigate the frame to about:blank. The second
      // iteration's |f| should still be created with the prototype.

      var a = d.createElement("a");
      a.href = "about:blank";
      a.click();
    }
  });
}, "objects created with correct creation context");

</script>
</body>
